package com.whfc.quality.enums;

/**
 * @author : qzexing
 * @version : 1.0
 * @date : 2020-07-29 16:09
 */
public enum QualityCheckState {

    TO_BE_RECTIFIED(10, "待整改"),

    UNQUALIFIED_REVIEW(11, "待整改(复查不合格)"),

    UNQUALIFIED_VERIFY(12, "待整改(核验不合格)"),

    TO_BE_REVIEWED(20, "待复查"),

    TO_BE_VERIFIED(30, "待核验"),

    SUCCESS(100, "已完成");

    private Integer value;

    private String desc;

    public Integer getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    QualityCheckState(Integer value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static QualityCheckState parseValue(int value) {
        switch (value) {
            case 10:
                return TO_BE_RECTIFIED;
            case 11:
                return UNQUALIFIED_REVIEW;
            case 12:
                return UNQUALIFIED_VERIFY;
            case 20:
                return TO_BE_REVIEWED;
            case 30:
                return TO_BE_VERIFIED;
            case 40:
                return SUCCESS;
            default:
                return null;
        }
    }

    public static Integer[] process(Integer value) {
        switch (value) {
            case 10:
            case 11:
            case 12:
                return new Integer[]{2, 3, 4};
            case 20:
                return new Integer[]{3, 4};
            case 30:
                return new Integer[]{4};
            default:
                return null;
        }
    }
}
